package Testes;

import junit.framework.AssertionFailedError;
import junit.framework.Test;
import junit.framework.TestResult;

public abstract class TestCase implements Test { 
	private final String fName; 
	public TestCase(String name) { 
		fName= name; 
	} 



	public void run(TestResult result) { 
		result.startTest(this); 
		setUp(); 
		try { 
			runTest(); 
		} catch (AssertionFailedError e) {
			result.addFailure(this, e); 
		} catch (Throwable e) {
			result.addError(this, e); 
		} finally {
			tearDown(); 
		} 
	}
	private void runTest() {


	}



	protected void assertTrue(boolean condition) { 
		if(!condition) {
			throw new AssertionFailedError();
		}
	}
	protected void setUp() { 
	} 

	protected void tearDown() { 
	}
	public TestResult run() { 
		TestResult result= createResult(); 
		run(result); 
		return result; 
	} 
	protected TestResult createResult() { 
		return new TestResult(); 
	}
}

